#ifndef __COMPONENT_SHAPESHIFTER_H__
#define __COMPONENT_SHAPESHIFTER_H__

#include "Components/Component.hpp"
#include "Engine/MathUtils.hpp"
#include "Engine/Vector2.hpp"

#include "EasyMachine.hpp"

using namespace PocketSurvival::Engine;

namespace PocketSurvival
{
    struct ComponentBody;
    struct ComponentSpawn;
    struct ComponentHealth;

    class SubsystemGameInfo;
    class SubsystemWeather;

    struct ComponentShapeshifter : public Component
    {
    protected:
        std::string m_nightEntityTemplateName;
        std::string m_dayEntityTemplateName;
        float m_timeToSwitch;
        
    public:
        ComponentBody *componentBody;
        ComponentSpawn *componentSpawn;
        ComponentHealth *componentHealth;

        SubsystemGameInfo* gameInfo;
        SubsystemWeather *subsystemWeather;

        bool isEnabled;
        bool isShapeshiftTo = false;


        void shapeshiftTo(const std::string &entityTemplateName);


        virtual void update(float dt) override;
        virtual void load(const nlohmann::json &jsonData) override;
        virtual const std::string &getName() const override;
        static const std::string &GetName();
    };
}

#endif
